<?php

use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;

function sendNotification($content)
{
    // 发送到企业微信
    $apiUrl = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=c087dafe-df75-4d35-bfa1-cceaf0de7918';
    $params = [
        'msgtype' => 'markdown',
        'markdown' => [
            'content' => $content
        ]
    ];
    $response = Http::withHeaders([
        'Content-Type' => 'application/json'
    ])->post($apiUrl, $params);
    if (!$response->successful()) {
        Log::error('发送企业微信消息失败');
    }
}
